package com.jinzecloud.fiction.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.jinzecloud.fiction.bean.TbBooklist;
import com.jinzecloud.fiction.service.TbBooklistService;
import com.jinzecloud.fiction.utils.PageUtils;
import com.jinzecloud.fiction.utils.R;



/**
 * 榜单表
 *
 * @author ??
 * @email 1971240051@qq.com
 * @date 2023-10-19 19:38:04
 */
@RestController
@RequestMapping("fiction/tbbooklist")
public class TbBooklistController {
    @Autowired
    private TbBooklistService tbBooklistService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("fiction:tbbooklist:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tbBooklistService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{blId}")
    //@RequiresPermissions("fiction:tbbooklist:info")
    public R info(@PathVariable("blId") Integer blId){
		TbBooklist tbBooklist = tbBooklistService.getById(blId);

        return R.ok().put("tbBooklist", tbBooklist);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("fiction:tbbooklist:save")
    public R save(@RequestBody TbBooklist tbBooklist){
		tbBooklistService.save(tbBooklist);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("fiction:tbbooklist:update")
    public R update(@RequestBody TbBooklist tbBooklist){
		tbBooklistService.updateById(tbBooklist);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("fiction:tbbooklist:delete")
    public R delete(@RequestBody Integer[] blIds){
		tbBooklistService.removeByIds(Arrays.asList(blIds));

        return R.ok();
    }

}
